<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%@ include file="../include/header.jsp" %>
<c:if test="${sessionScope.userid == null }">
	<script type="text/javascript">
		alert("로그인이 필요한 서비스입니다");
		location.href="${path}/member/login.jsp";
	</script>
</c:if>
<script type="text/javascript">
function class1_update(){
	var form_class = document.getElementById("form_class");
	var subject = document.getElementById("subject");
	var content = document.getElementById("content");
	if( subject.value == "" ) {
		alert("제목을 입력하세요");
		subject.focus();
		return;
	}
	if( content.value == "" ) {
		alert("본문을 입력하세요");
		content.focus();
		return;
	}
	form_class.action = "${path}/class1/class1_update.do";
	form_class.submit();
}
</script>
</head>
<body>
<h2>강좌게시물 수정/삭제</h2>
<form name="form_class" id="form_class" method="post">
 <table border="1" style="width:898px; margin:0 auto;">
  <tr>
   <td style="text-align:left;">Subject</td>
   <td><input type="text" name="subject" id="subject" value="${dto.subject}" size="80"/></td>
  </tr>
  <tr>
   <td style="text-align:left;">Content</td>
   <td><textarea rows="13" cols="80" wrap="soft" name="content" id="content">${dto.content}</textarea></td>
  </tr>
  <tr>
   <td colspan="2" style="text-align: center;">
   <!-- 수정/삭제에 필요한 게시물 번호 전달 -->
   <input type="hidden" name="idx" value="${dto.idx}">
   <input type="button" value="수정" onclick="class1_update()">
   <input type="button" value="목록" onclick="location.href='${path}/class1/class1_list.do';">
   </td>
  </tr>
 </table>

</form>

</body>
</html>